﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KPI.Utility;
using KPI.ProjectDomain.Model.Entity;
using KPI.ProjectDomain.Model.ValueObject;

namespace KPI.ProjectDomain.Infrastructure.DbObject
{
    public class ProjectTab:EntityBase
    {
        public int ProjectID { get; set; }
        public string Name { get; set; }
        public string Description { get; set; }
        public int FirstProjectManagerID { get; set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="DepartmentTab"/> class.
        /// </summary>
        public ProjectTab() { }

        /// <summary>
        /// Initializes a new instance of the <see cref="DepartmentTab"/> class.
        /// </summary>
        /// <param name="department">The department.</param>
        public ProjectTab(Project project)
        {
            this.CreatedDate = project.CreatedDate;
            this.ProjectID = project.ProjectID;
            this.Description = project.Description;
            if (project.FirstProjectManager != null)
                this.FirstProjectManagerID = project.FirstProjectManager.EmployeeID;
            this.IsDeleted = project.IsDeleted;
            this.LastModifiedDate = project.LastModifiedDate;
            this.Name = project.Name;
            this.Version = project.Version;
        }

        /// <summary>
        /// Fills the department.
        /// </summary>
        /// <param name="copy">The department.</param>
        /// <param name="source">The department DBO.</param>
        /// <returns></returns>
        public static Project FillDepartment(ProjectTab source, Project copy)
        {
            copy.ProjectID = source.ProjectID;
            return source.Copy<Project>(copy);
        }
    }
}
